<%@ page language="java" contentType="text/html" pageEncoding="utf-8"%>
<%@include file="/WEB-INF/pages/common/common.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head> 
    <%@include file="/WEB-INF/pages/common/head.jsp"%>
    <%@include file="/resources/datepicker/datepicker.jsp"%>
    <title><spring:message code="title.ipic.target"/></title>
      <style type="text/css">
        .font_stress{
            color: red;font-size: 13px;font-weight:bold;
        }
    </style>
    <script type="text/javascript">
         var operateDialog;
          var datagrid;
	        $(function() {
	            datagrid=$('#datagrid').datagrid({
	                onDblClickCell:function(rowIndex){
	                    var rows = datagrid.datagrid('getRows');
	                    for ( var i = 0; i < rows.length; i++) {
	                         datagrid.datagrid('endEdit', i);
	                    }
	                        datagrid.datagrid('beginEdit', rowIndex);
	                }
	            });
	            
	        });
	        
	       function save_(){
          
           if($("#supplierCode").val()==''){
               $.messager.alert('提示','供应商不能为空');
                 return;
            }  
          
            var v1 = $("#planificationDates").val();
		    if(v1==''){
		            $.messager.alert('<spring:message code='msg.tip'/>','计划日期不能为空!');
		            return;
		    }
		   var v2 = $("#certificationDates").val();
		    if(v2==''){
		            $.messager.alert('<spring:message code='msg.tip'/>','审核日期不能为空!');
		            return;
		    }
          
           var v3 = $("#requestActionDates").val();
		    if(v3==''){
		            $.messager.alert('<spring:message code='msg.tip'/>','要求行动的日期不能为空!');
		            return;
		    }
		    
		    var v4 = $("#actionIncomingDates").val();
		    if(v4==''){
		            $.messager.alert('<spring:message code='msg.tip'/>','行动来临的日期不能为空!');
		            return;
		    }
		    
		    var v5 = $("#agreedActionDates").val();
		    if(v5==''){
		            $.messager.alert('<spring:message code='msg.tip'/>','同意行动的日期不能为空!');
		            return;
		    }
		    
		    
	         var isV =$("#tableForm").form("validate");
            if(!isV) return; 
            imonJYRH.showZone();
            $.ajax({
                url : '${path}/business/supplier_quality/audit/ajaxAdd.do',
                  data : $("#tableForm *").serialize(),
                 cache : false,
                 async : true,
                 dataType : "json",
                success : function(reMsg) {
                    if(reMsg.success){
                        parent.returnResult();
                        message.show({ msg : reMsg.msg,title : '<spring:message code='msg.tip'/>',showType:'slide'});
                    }else{
                        if(!imonJYRH.isBlank(reMsg.obj)){
                            $.messager.alert('<spring:message code='msg.tip'/>',reMsg['obj']);
                        }else{
                            $.messager.alert('<spring:message code='msg.tip'/>',reMsg['msg']);
                        }
                    }
                    imonJYRH.hideZone();
                }
            });
        }
        
        function dialogSupplier_(){
            var href = '${path}/basedata/supplier/dialogUI.do';
            operateDialog = $("#operateDialog").dialog({
                title : '<spring:message code='msg.dialog.choose'/>',
                width : 650,
                height : 400
            });
            $("#operateIFrame")[0].src=href;
            operateDialog.dialog('open');
        }
     function dialogSupplierReturn(row){
            $("#supplierId").val(row['id']);
            $("#supplierCode").val(row['code']);
            $("#supplierName").val(row['name']);
            operateDialog.dialog('close');
        }
    </script>
</head>
<body>
<table width="100%" id="tableForm" class="tableForm">

 		  <tr>
                    <td align="right"> <span style="color:red;">*</span>SupplierCode供应商编码：</td>
                    <td>
                        <input type="hidden" id='supplierId' name="supplierId"/>
                        <input type="text" id="supplierCode" onclick="dialogSupplier_();" readonly="true"/>
                    </td>
                    <td align="right">SupplierName供应商名称：</td>
                    <td>
                       <input type="text" id="supplierName" style="width: 180px;" disabled/>
                    </td>
           </tr>
       <tr>
        <td align="right"><span style="color:red;">*</span>Project项目：</td>
        <td>
            <input type="text" name="project" data-options="required:true" class="easyui-validatebox"/>
        </td>
        <td align="right"><span style="color:red;">*</span>Auditor审核者：</td>
        <td>
            <input type="text" name="auditor" data-options="required:true" class="easyui-validatebox"/>
        </td>
  </tr>
    <tr>
        <td align="right"><span style="color:red;">*</span>Audit Code审核编码：</td>
        <td>
            <input type="text" name="code" data-options="required:true" class="easyui-validatebox"/>
        </td>
          <td align="right"><span style="color:red;">*</span>Evaluation Value估值： </td>
        <td>
            <input type="text" name="value" data-options="required:true" class="easyui-numberbox"/>
        </td>
    </tr>
    <tr>
        <td align="right"><span style="color:red;">*</span>Planification Date计划日期：</td>
        <td>
            <input type="text" name="planificationDates" id="planificationDates"  data-options="required:true" onFocus="WdatePicker({isShowClear:false,isShowToday:false,readOnly:true})" class="field Wdate" />
        </td>
   	     <td align="right"><span style="color:red;">*</span>Certification Date审核日期：</td>
        <td>
            <input type="text"  name="certificationDates"  id="certificationDates"  data-options="required:true" onFocus="WdatePicker({isShowClear:false,isShowToday:false,readOnly:true})" class="field Wdate" />
        </td>
    </tr>
    
    <tr>
        <td align="right"><span style="color:red;">*</span>Requested Actions Date要求行动的日期： </td>
        <td>
            <input type="text"   name="requestActionDates" id="requestActionDates"   data-options="required:true" onFocus="WdatePicker({isShowClear:false,isShowToday:false,readOnly:true})" class="field Wdate" />
        </td>
        <td align="right"><span style="color:red;">*</span>Action Incoming Date行动来临的日期： </td>
        <td>
            <input type="text"  name="actionIncomingDates" id="actionIncomingDates"  data-options="required:true" onFocus="WdatePicker({isShowClear:false,isShowToday:false,readOnly:true})" class="field Wdate" />
        </td>
    </tr>
    <tr>
       <td align="right"><span style="color:red;">*</span>Agreed Action Date同意行动的日期：</td>
        <td>
            <input type="text"   name="agreedActionDates" id="agreedActionDates"  data-options="required:true" onFocus="WdatePicker({isShowClear:false,isShowToday:false,readOnly:true})" class="field Wdate" />
        </td>
        <td align="right"><span style="color:red;">*</span>Capability产能：</td>
        <td>
            <input type="text" name="capability" data-options="required:true"  class="easyui-validatebox"/>
        </td>
    </tr>
    <tr>
        <td align="right">Comment评论：</td>
        <td colspan="5">
            <textarea rows="3" cols="50" name="comment"></textarea>
        </td>
    </tr>
</table>
<br />
<div align="right">
    <a class="easyui-linkbutton" href="javascript:void(0);" iconCls="icon-save" onclick="save_()">Save保存</a>
    <a class="easyui-linkbutton" href="javascript:void(0);" iconCls="icon-no" onclick="parent.operateDialog.dialog('close');">Close关闭</a>
</div>
<div id="operateDialog" class="easyui-dialog" style="width:900px;height:520px;"
     data-options="iconCls:'icon-save',resizable:true,modal:true,closed: true,collapsible:true,maximizable:true">
    <iframe scrolling="auto" id='operateIFrame' frameborder="0"  src="" style="width:100%;height:100%;"/>
</div>
</body>
</html>
